package com.lvmama.controller.dw.priceStock;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.lvmama.common.result.Result;
import com.lvmama.common.utils.PageInfoUtil;
import com.lvmama.pojo.dto.dw.StockDetailQuery;
import com.lvmama.pojo.entity.dw.priceStock.StockDetail;
import com.lvmama.service.dw.StockService;

/**
 * @Author:xuzhongwei
 * @Description:
 * @Date：2018/08/06
 */
@RestController
@RequestMapping("/stock")
public class StockController {

    @Autowired
    StockService stockService;
    /**
     * 查询库存详情
     *
     * @param query 查询条件
     * @return 库存详情
     */
    @PostMapping("/selectStockDetail")
	public Result<List<StockDetail>> selectStockDetail(@RequestBody StockDetailQuery query){
    	return this.stockService.selectStockDetail(query);
    }
    /**
     * 查询库存详情-缓存
     *
     * @param query 查询条件
     * @return 库存详情
     */
    @PostMapping("/selectStockDetailRedis")
    public Result<List<StockDetail>> selectStockDetailRedis(@RequestBody StockDetailQuery query){
    	return this.stockService.selectStockDetailRedis(query);
    }

    /**
     * 查询库存明细详情分页
     *
     * @param query 查询条件
     * @return 库存详情分页
     */
    @PostMapping("/selectStockDetailPage")
	public Result<PageInfo<StockDetail>> selectStockDetailPage(@RequestBody StockDetailQuery query){
    	return this.stockService.selectStockDetailPage(query);
    }

    /**
     * 查询库存汇总详情分页-缓存数据
     *
     * @param query 查询条件
     * @return 库存详情分页
     */
    @PostMapping("/selectStockDetailPageByRedis")
	public Result<PageInfoUtil<StockDetail>> selectStockDetailPageByRedis(@RequestBody StockDetailQuery query){
    	return this.stockService.selectStockDetailPageByRedis(query);
    }
}
